home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Random2.0
/
Source
/
ElkinsEngine.h
< prev
next >
Wrap
Text File
|
1995-06-12
|
2KB
|
66 lines
//
// ElkinsEngine
//
// This is an Objective-C class which uses
// the Random architecture from
// Contemporary Design Studios.
//
// The ElkinsEngine class implements a random number generator with a cycle
// length of 8.8 trillion.
//
// Upon creation of an ElkinsEngine, the seeds are set using the system clock.
// Three calls are made to the system clock function, and for each the
// microseconds are used as the seed value. Thus, the relationships between
// the seeds are dependant upon system load.
//
// The algorithm used by the ElkinsEngine class is that given in the article:
// "A Higly Random Random-Number Generator" by T.A. Elkins
// Computer Language, 1989 December (Volume 6, Number 12), Page 59.
// Published by:
// Miller Freeman Publications
// 500 Howard Street
// San Francisco, CA 94105
// 415-397-1881
//
// Copyright (C) 1992 Contemporary Design Studios. All rights reserved.
//
#import "RandomEngine.h"
@interface ElkinsEngine : RandomEngine
{
ushort h1, h2, h3; // Seeds.
}
+ (ulong)unit;
- init;
- initSeeds:(ushort)s1 // Init with seeds given.
:(ushort)s2
:(ushort)s3;
- newSeeds; // Get seeds from system time.
- setSeeds:(ushort) s1 // Set seeds to those given.
:(ushort) s2
:(ushort) s3;
- getSeeds:(ushort *)s1 // Put the seeds into some vars.
:(ushort *)s2
:(ushort *)s3;
- makeRandom:(uchar *)storage;
- read:(NXTypedStream *)stream;
- write:(NXTypedStream *)stream;
@end
//
// End of file.
//